package com.java.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.java.model.*;
import com.java.service.*;
import com.java.utils.CommonUtils;
import com.java.utils.JsonBody;
import com.java.utils.ResponseUtil;
import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;;

@RestController
@RequestMapping("/admin")
public class AdminController {
	private AdminService adminService;

	public AdminService getAdminService() {
		return adminService;
	}

	@Autowired
	public void setAdminService(AdminService adminService) {
		this.adminService = adminService;
	}

	@Autowired
	private HttpServletRequest request;
	@Autowired
	private HttpServletResponse response;

	@CrossOrigin(origins = "*")
	@RequestMapping("/pwd")
	@ResponseBody
	public JsonBody pwd(@RequestBody Admin c) {
		int r=adminService.EditPass(c);
		if(r>0)
			return Util.SetMap("修改成功,请重新登陆",true);
		else
			return Util.SetMap("密码修改失败",false);
	}


}
